package com.shanzmoo.db.personnel.entity.dto;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.base.constant.RegularExpression;
import com.shanzmoo.db.personnel.entity.MemberInvoiceEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * 用户发票保存对象
 *
 * @author: Gzhao 2020/12/25
 */
@Data
@ApiModel("用户发票保存对象")
public class MemberInvoiceSaveDto implements Serializable {

    private static final long serialVersionUID = 1758L;

    @NotBlank(message = "单位名称（个人名称）不允许为空")
    @ApiModelProperty(value = "单位名称（个人名称）", example = "三鞭道人")
    private String title;

    @NotBlank(message = "发票识别号（手机号码）不允许为空")
    @ApiModelProperty(value = "发票识别号（手机号码）", example = "14728523693")
    private String identification;


    @Pattern(regexp = RegularExpression.EMAIL, message = "请输入正确的邮箱格式")
    @NotBlank(message = "邮箱不允许为空")
    @ApiModelProperty(value = "邮箱", example = "123@qq.com")
    private String email;

    @NotBlank(message = "发票内容不允许为空")
    @ApiModelProperty(value = "发票内容：0-购物明细，1-数据电子，2-3c类型", example = "2")
    private Integer contentType;

    public MemberInvoiceEntity convert() {
        return JSON.parseObject(JSON.toJSONString(this), MemberInvoiceEntity.class);
    }
}
